package cz.muni.fi.pa165.dundd.serviceImpl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

/**
 *
 * @author xdemocko
 */
public class AdministratorLoginDetails implements UserDetails, Serializable{

    
    private static final long serialVersionUID = 687651441578268L;
    private long id;
    private String password;
    private String username;
    private Collection<GrantedAuthority> authorities = null;

    public AdministratorLoginDetails(Long id, String name, String password, GrantedAuthority[] authorities){
        this.id = id;
        this.username = name;
        this.password = password;
        this.authorities = new ArrayList<>();
        this.authorities.addAll(Arrays.asList(authorities));        
    }

    @Override
    public Collection<GrantedAuthority> getAuthorities() {
        return authorities;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }        
    
    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.username;
    }

    @Override
    public boolean isAccountNonExpired() {
       return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }  
    
}
